package me.xiaoyan.ehr.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import me.xiaoyan.ehr.mapper.SysNoticeMapper;
import me.xiaoyan.ehr.po.SysNotice;
import me.xiaoyan.ehr.service.SysNoticeService;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.Map;

/**
 *
 */
@Service
public class SysNoticeServiceImpl extends BaseService<SysNoticeMapper, SysNotice> implements SysNoticeService {

    @Override
    public IPage<SysNotice> selectByParams(Map<String, String> params) {
        QueryWrapper<SysNotice> query = new QueryWrapper<>();
        query.orderByDesc("id"); // and status = 1
        query.eq("status", 1); // and status = 1
        if (StringUtils.hasLength(params.get("title"))) {
            // sql 等价于 where title like '%参数%'
            query.like("title", params.get("title"));
        }
        return selectByPage(params, query);
    }
}




